<template>
	<view>
		<navbar title="提单审核详情" :autoBack="true"></navbar>
		<scroll-view scroll-y="true" >
			<view class="con">
				<view class="con__a">
					<view class="u-flex u-flex-y-center u-flex-between">
						<view class="con__a__t">
							审批详情
						</view>
						<view class="con__a__time">
							提单时间:{{info.submit}}
						</view>
					</view>
					<view class="con__a__box">
						<view class="con__box__b__text">
							姓名: {{info.username}}
						</view>
						<view class="con__box__b__text">
							电话: {{info.mobile}}
						</view>
						<view class="con__box__b__text">
							销售: {{info.saleName}}
						</view>
						<view class="con__box__b__text">
							贷款额度需求: {{info.dedamount}}元
						</view>
						<view class="con__box__b__text">
							房产情况: {{info.house}}
						</view>
						<view class="con__box__b__text">
							车辆情况: {{info.car}}
						</view>
						<view class="con__box__b__text">
							工作单位: {{info.company}}
						</view>
						<view class="con__box__b__text">
							工作职位: {{info.role}}
						</view>
						<view class="con__box__b__text">
							月收入: {{info.salary}}
						</view>
						<view class="con__box__b__text">
							婚姻状况: {{info.marriage}}
						</view>
						<view class="con__box__b__text">
							社保: {{info.sb}}
						</view>
						<view class="con__box__b__text">
							公积金: {{info.gjj}}
						</view>
						<view class="con__box__b__text">
							负债情况: {{info.debt}}
						</view>
						<image src="/static/tool/spz.png" class="con__a__box__sp" mode=""></image>
					</view>
				</view>
				
			</view>
		</scroll-view>
		<view class="footer">
			<input type="number" v-if="status==2" class="footer__inp" v-model="loan_amount" placeholder="通过前先输入放款额度" />
			<view class="u-flex u-flex-xy-center">
				<u-button color="#3262FD" text='拒绝' :loading='loading' @click="submit(6)"
					:customStyle='{width:"304rpx",height:"87rpx",margin:"0 15rpx 0 0",padding:0,borderRadius:"5rpx",fontSize:"24rpx"}'></u-button>
				<u-button color="#D5D5D5" hairline plain text='通过' :loading='loading' @click="submit(2)"
					:customStyle='{width:"304rpx",height:"87rpx",margin:"0 0 0 15rpx",padding:0,borderRadius:"5rpx",fontSize:"24rpx",color:"#242424"}'></u-button>
			</view>
		</view>
	</view>
</template>

<script>
	import boos from '@/api/_boos.js'
	export default {
		data() {
			return {
				id:null,
				info:{},
				loading:false,
				status:null,
				loan_amount:''
			};
		},
		onLoad(o) {
			this.id=o.id
			this.status=o.status
			this.getinfo()
		},
		methods:{
			async getinfo(){
				let res = await boos.loanInfo({id:this.id})
				if(res.data.code==1){
					this.info=res.data.data
				}
			},
			async submit(status){
				let _this=this
				if(this.status==1){
					this.loading=true
					let res = await boos.editLoan({status,id:this.id})
					if(res.data.code==1){
						uni.$u.toast('提交成功')
						setTimeout(()=>{
							_this.loading=false
							uni.navigateBack()
						},1000)
					}else{
						uni.$u.toast('提交失败')
						_this.loading=false
					}
				}
				if(this.status==2){
					if(status==6){
						this.loading=true
						let res = await boos.editLoan({status,id:this.id})
						if(res.data.code==1){
							uni.$u.toast('提交成功')
							setTimeout(()=>{
								_this.loading=false
								uni.navigateBack()
							},1000)
						}else{
							uni.$u.toast('提交失败')
							_this.loading=false
						}
					}else{
						if(!this.loan_amount){
							uni.$u.toast('通过之前请先输入放款额度')
							return
						}
						console.log('跳转放款表单')
						uni.navigateTo({
							url:'/pages/examine/lending?id='+this.id+'&loan_amount='+this.loan_amount
						})
					}
				}
			}
		}
	}
</script>

<style lang="scss">
page{
	background-color: #f8f8f8;
}
.con{
	padding: 20rpx 30rpx 170rpx;
	&__a{
		background: #FFFFFF;
		border-radius: 20rpx;
		padding: 45rpx 30rpx 43rpx;
		margin-bottom: 27rpx;
		&__t{
			font-family: PingFang SC;
			font-weight: 800;
			font-size: 32rpx;
			color: #010101;
			line-height: 32rpx;
		}
		&__time{
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 24rpx;
			color: #6D6D6D;
			line-height: 24rpx;
		}
		&__box{
			background: #F4F5FA;
			border-radius: 20rpx;
			margin-top: 32rpx;
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 26rpx;
			color: #78797E;
			line-height: 64rpx;
			padding: 10rpx 22rpx 24rpx;
			position: relative;
			&__sp{
				width: 105rpx;
				height: 92rpx;
				position: absolute;
				top: 67rpx;
				right: 33rpx;
			}
		}
	}
	&__b{
		padding: 34rpx 30rpx 32rpx;
		background: #FFFFFF;
		border-radius: 20rpx;
		display: flex;
		&__pic{
			width: 177rpx;
			height: 177rpx;
			background: #3262FD;
			border-radius: 15rpx;
			margin-right: 18rpx;
		}
		&__name{
			width: 420rpx;
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 30rpx;
			color: #1E1E1E;
			line-height: 52rpx;
			margin-bottom: 6rpx;
		}
		&__text{
			width: 420rpx;
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 24rpx;
			color: #7A7A7A;
			line-height: 24rpx;
			margin-bottom: 18rpx;
		}
	}
}
.footer {
		width: 690rpx;
		height: 280rpx;
		background: #FFFFFF;
		padding: 0 30rpx;
		position: fixed;
		bottom: 0;
		left: 0;
		&__inp {
			height: 108rpx;
			font-family: PingFang SC;
			font-weight: 500;
			font-size: 28rpx;
			color: #333;
			line-height: 108rpx;
			border-bottom: 4rpx solid #ECE6E6;
			margin-bottom: 32rpx;
			display: flex;
			align-items: center;
			::v-deep.uni-input-placeholder {
				font-size: 28rpx;
				color: #6D6D6D;
			}
		}
		&__dian{
			width: 10rpx;
			height: 10rpx;
			background: #3262FD;
			border-radius: 50%;
			margin-right: 8rpx;
		}
	}
</style>
